import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.io.File;
import java.io.StringReader;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;


public class ReportCreator {
	static String xmlData = "";
	
	static NumberFormat formatter;	
	static String pageWidth = "21cm";
	static double usablePageSpace = 15.75;
	static String headerHeight = "2.50cm";
	static String footerHeight = "2.00cm";
	static String pageHeight = "29.7cm";
	static String bodyHeight = "24.6cm";
	
	static String sideMargins = "2.54cm";
	static String topbottomMargins = "0cm";
	static String columnSpacing = "1.27cm";
	static double spaceFromTopHeightOfRow = 0.9;
	static double spaceFromTopHeightOfFieldRow = 0.75;
	//Generated Title
	static String titleNamePrefix = "titleBox";
	static String titleFont = "Calibri Light";
	static String titleFontSize = "14pt";
	static String titleFontWeight = "Bold";
	static String titleFontColor = "#0094d4";
	static String titleLeft = "0.0cm";
	static String titleHeight = "0.8cm";
	static String titleWidth = "5in";
	static String titleZIndex = "29";
	static String titlePaddingLeft = "2pt";
	static String titlePaddingRight = "2pt";
	static String titlePaddingTop = "2pt";
	static String titlePaddingBottom = "2pt";
	
	//Generated Fields
	static String fieldNamePrefix = "fieldBox";
	static String fieldFont = "Calibri";
	static String fieldFontSize = "10pt";
	static String fieldFontWeight = "Bold";
	static String fieldFontColor = "#0094d4";
	static double fieldLeft = 0.0;
	static double fieldHeight = 0.575;
	static double fieldp1Width = 3.0;
	static double fieldp2Width = 4.5;
	static double fieldSpaceWidth = 0.45;
	static String fieldZIndex = "29";
	static String fieldPaddingLeft = "2pt";
	static String fieldPaddingRight = "2pt";
	static String fieldPaddingTop = "2pt";
	static String fieldPaddingBottom = "2pt";	
	static String fieldBorder = "2pt";	
	
	//Generated subtitles
	static String fieldSubFontSize = "10pt";
	static double fieldSubHeight = 0.675;
	
	//LOGO:
	static String logoName = "logoimage";
	static String logoFromTop = "0.74366cm";
	static String logoFromLeft = "4.90839in";
	static String logoHeight = "0.54167in";
	static String logoWidth = "1.27604in";
	
	//HEADER TEXT:
	static String headerText = "noName";
	static String headerFont = "Calibri Light";
	static String headerFontSize = "20pt";
	static String headerFontBold = "Bold";
	static String headerFontColor = "#0094d4";
	static String headerTextBoxName = "headerTextBox";
	static String headerTextFromTop = "0.74366cm";
	static String headerTextFromLeft = "0.10598cm";
	static String headerTextHeight = "0.4in";
	static String headerTextWidth = "4.6in";
	static String headerZIndex = "1";
	static String headerPaddingLeft = "2pt";
	static String headerPaddingRight = "2pt";
	static String headerPaddingTop = "2pt";
	static String headerPaddingBottom = "2pt";
	
	//FOOTER
	static String footerPageFont = "Calibri Light";
	static String footerPageFontSize = "11pt";
	static String footerPageFontColor = "#0094d4";
	static String footerPageTextFromTop = "0.32333in";
	static String footerPageTextFromLeft = "5.18443in";
	static String footerPageTextHeight = "0.25in";
	static String footerPageTextWidth = "1in";
	static String footerPagePaddingLeft = "2pt";
	static String footerPagePaddingRight = "2pt";
	static String footerPagePaddingTop = "2pt";
	static String footerPagePaddingBottom = "2pt";
	
	static String footerRestrictionName = "restrictionBox";
	static String footerRestrictionFont = "Calibri Light";
	static String footerRestrictionFontSize = "11pt";
	static String footerRestrictionFontColor = "#0094d4";
	static String footerRestrictionTextFromTop = "0.13583in";
	static String footerRestrictionTextFromLeft = "0.10598cm";
	static String footerRestrictionTextHeight = "0.4375in";
	static String footerRestrictionTextWidth = "3.56946in";
	static String footerRestrictionTextZIndex = "1";
	static String footerRestrictionPaddingLeft = "2pt";
	static String footerRestrictionPaddingRight = "2pt";
	static String footerRestrictionPaddingTop = "2pt";
	static String footerRestrictionPaddingBottom = "2pt";
	
	
	
	
	static int _id = 0;
	static double spaceFromTop = 0.0f;
	static double titleSpaceHeight = 0.8f;
	static String dataSetName = "";
	
	
	
	public static void run(String name, String dataSet, SubReportType currentType, ReportType currentInspeciton){
		//System.out.println("Beginning");
		
		
		String headerText = name;
		dataSetName = dataSet;
		
		//ENTER VALUES
		
		//String headerTextValue = "Blade Inspection Report";
		//dataSetName = "Blade";
		//String headerTextValue = "Gearbox Inspection Report";
		//dataSetName = "Gearbox";
		//String headerTextValue = "General Inspection Report";
		//dataSetName = "General";
		//String headerTextValue = "Generator Inspection Report";
		//dataSetName = "Generator";
		//String headerTextValue = "Main Bearings Inspection Report";
		//dataSetName = "MainBearings";
		//String headerTextValue = "SkiiPACK Inspection Report";
		//dataSetName = "Skiipack";
		//String headerTextValue = "Transformer Inspection Report";
		//dataSetName = "Transformer";
		
		
		
		//headerText = headerTextValue + " - Failure";
		//ReportType currentType = ReportType.Failure;
		//headerText = headerTextValue + " - Inspection";
		//ReportType currentType = ReportType.Inspection;
		//headerText = headerTextValue + " - Repair";
		//ReportType currentType = ReportType.Repair;


		
		
		
		
		//DONT TOUCH
		init();
		intiBody();
		
		
		//CREATE CONTENT:
		if (currentInspeciton != ReportType.Case)
			createGeneralContent(currentType);
		
		if (currentInspeciton == ReportType.Blade)
			createBladeInspection(currentType);
		else if (currentInspeciton == ReportType.Gearbox)
			createGearboxInspection(currentType);
		else if (currentInspeciton == ReportType.General)
			createGeneralInspection(currentType);
		else if (currentInspeciton == ReportType.Generator)
			createGeneratorInspection(currentType);
		else if (currentInspeciton == ReportType.Main)
			createMainBearingContent(currentType);
		else if (currentInspeciton == ReportType.Skiipack)
			createSkiipackContent(currentType);
		else if (currentInspeciton == ReportType.Transformer)
			createTransformerContent(currentType);
		else if (currentInspeciton == ReportType.Case)
			createCaseContent(currentType);
		
		
		if (currentInspeciton != ReportType.Case)
			createVersionInformation(currentType);
				
		
		
		//DONT TOUCH
		closeBody();
		//Creating header
		createHeaderAndFooter();
		//Close
		close();
		save();
		
		Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
		  Transferable transferable = new StringSelection(xmlData);
		  clipboard.setContents(transferable, null);
	}

	private static void createCaseContent(SubReportType currentType) {
		createTitle("Summary");
		createDualRow("Owner:", "ownerid", "External Contact:", "mvow_externalcontact");
		createDualRow("Case Title:", "title", "ID", "ticketnumber");
		createDualRow("Status:", "mvow_status", "Priority:", "prioritycode");
		createDualRow("Discovered At:", "mvow_discoveredat", "Improvement Case:", "mvow_improvementcase");
		createDualRow("Audit / Inspection:", "mvow_auditinspection", "Site:", "mvow_site");
		createDualRow("Wind Turbine:", "mvow_windturbine", "Order Number:", "mvow_ordernumber");
		createMultiLine("Fault Description:", "mvow_faultdescription");
		
		createTitle("Actions");
		createMultiLine("Immediate Corrective Action:", "mvow_immediatecorrectiveaction");
		createMultiLine("Containment Action:", "mvow_containmentaction");
	
		createTitle("Main Component");
		createDualRow("Item Number:", "mvow_mainitemitemnumber", "Amount:", "mvow_mainitemamount");
		createMultiLine("Description:", "mvow_mainitemdescription");
		createMultiLine("Serial Number:", "mvow_mainitemserialnumbers");
		
		createTitle("Sub-Component");
		createDualRow("Item Number:", "mvow_subcomponentitemitemnumber", "Amount:", "mvow_subcomponentitemamount");
		createMultiLine("Description:", "mvow_subcomponentitemdescription");
		createMultiLine("Serial Number:", "mvow_subcomponentitemserialnumbers");
		
		createTitle("Defect Item");
		createDualRow("Item Number:", "mvow_defectitemitemnumber", "Amount:", "mvow_defectitemamount");
		createMultiLine("Description:", "mvow_defectitemdescription");
		createMultiLine("Serial Number:", "mvow_defectitemserialnumbers");
	
		createTitle("Case Relationships");
		createSubTitle("Similar Cases", "");
		createEmptyLine();
		createEmptyLine();
		createSubTitle("Merged Cases", "");
		createEmptyLine();
		createEmptyLine();
		createSubTitle("Chils Cases", "");
		createEmptyLine();
		createEmptyLine();
		
		createTitle("Articles and Contract Information");
		createSubTitle("Articles", "Contract");
		createDualRow("Knowledge Base Article:", "kbarticleid", "Contract:", "contractid");
		createDualRow("", "", "Contract Line:", "contractdetailid");
		createDualRow("", "", "Serial Number:", "productserialnumber");
		createDualRow("", "", "Service Level:", "contractservicelevelcode");
		
		
	}

	private static void createBladeInspection(SubReportType currentType) {
		createTitle("Blade Data");
		createDualRow("Blade Number:","mvow_bladenumber", "Blade Manufacturer:","mvow_blademanufacturer");
		createDualRow("Blade Serial No:","mvow_bladeserialno", "Pictures Included:","mvow_picturesincluded");
		
		createTitle("Blade Damage");
		createEmptyLine();
		createEmptyLine();
		
		createTitle("Blade Inspection Data:");
		if(currentType == SubReportType.Repair){
			createSubTitle("Blade Repair Record", "");
			createDualRow("Ambient Temperature:", "mvow_ambienttemperature", "Humidity:", "mvow_humidity");
			createDualRow("Additional Document Reference:", "mvow_additionaldocumentreference", "Resin Type:", "mvow_resintype");
			createDualRow("Resin Type Batch Number:", "mvow_resintypebatchnumbers", "Resin Type Expiry Date:", "mvow_resintypeexpirydate");
			createSingleRow("Hardener Type Expiry Date:", "mvow_hardenertypeexpirydate");
			createDualRow("Hardener Type:", "mvow_hardenertype","Glass Supplier:", "mvow_glasssupplier");
			createSingleRow("Glass Supplier Batch Number:", "mvow_glasssupplierbtchnumbers");
			createSingleRow("Blade Surface Temperature During Lamination", "");
			createDualRow("Min:", "mvow_blade_min", "Max:", "mvow_blade_max");
			createSingleRow("Post Cure Surface Temperature", "");
			createDualRow("Min:", "mvow_cure_min", "Max:", "mvow_cure_max");
			createDualRow("Total Cure Time (hrs):", "mvow_totalcure","","");
			createSingleRow("Quanity of Mixed Resin Used (g):", "mvow_quanityofmixedresinused");
			createSingleRow("Heaters, Insulation Cover And Vacuum Off:", "mvow_heatersinsulaioncoverandvacuumoff");
			}
		
		createSubTitle("Fault Code:","");
		createDualRow("Overall Blade Condition:","mvow_overallbladecondition", "Cause:","mvow_cause");
		createDualRow("Type:","mvow_type", "Area:","mvow_area");
		
		createTitle("Test of Lightning System");
		createDualRow("Vestas Tool Number:","mvow_vestastoolnumber", "Calibration Date:","mvow_calibrationdate");
		createSubTitle("Receptor Leeward's Side Pre Repair","Receptor Leeward's Side Post Repair" );
		createDualRow("Tip:","mvow_leepretip", "Tip:","mvow_leeposttip");
		createDualRow("2:","mvow_leepre2", "2:","mvow_leepost");
		createDualRow("3:","mvow_leepre3", "3:","mvow_leepost3");
		createDualRow("4:","mvow_leepre4", "4:","mvow_leepost4");
		createDualRow("5:","mvow_leepre5", "5.","mvow_leepost5");
		createSubTitle("Receptor Windward's Side Pre Repair","Receptor Windward's Side Post Repair");
		createDualRow("Tip:","mvow_windpretip", "Tip:","mvow_windposttip");
		createDualRow("2:","mvow_windpre2", "2:","mvow_windpost2");
		createDualRow("3:","mvow_windpre3", "3:","mvow_windpost3");
		createDualRow("4:","mvow_windpre4", "4:","mvow_windpost4");
		createDualRow("5:","mvow_windpre5", "5:","mvow_windpost4");
		
	}
	
	
	private static void createGearboxInspection(SubReportType currentType) {
		createTitle("Gearbox Data");
		createDualRow("Gearbox (hrs):","mvow_generatorhrs", "Gearbox Production (kWh):","mvow_gearboxproduction");
		createDualRow("Date for Last Oil Change:","mvow_dateforlastoilchange", "Oil Level in Gearbox (%)","mvow_oillevelingearbox");
		createSingleRow("Type of Mechanical Oil Pump:","mvow_typeofmechanicaloilpump");
		createSingleRow("Oil Temperature at Oil Level Check (C):","mvow_oiltemperatureatoillevelcheck");
		
		createTitle("Additional Gearbox Data");
		createDualRow("Coupling:","mvow_coupling", "Filter Block Type:","mvow_filterblocktype");
		createDualRow("Software Release:","mvow_softwarerelease", "In-Line Filter:","mvow_inlinefilter");
		createDualRow("Off-line Filter:","mvow_offlinefflter", "","");
		
		createTitle("Clearly Identified Damages");
		createSubTitle("Gears", "");
		createEmptyLine();
		createEmptyLine();
		createSubTitle("Shafts", "");
		createEmptyLine();
		createEmptyLine();
		createSubTitle("Bearings", "");
		createEmptyLine();
		createEmptyLine();
		
		createTitle("Housing");
		createSubTitle("Housing","");
		createDualRow("Planet Stage 1:","mvow_planetstage1", "Planet Stage 2:","mvow_planetstage2");
		createDualRow("Helical / Parallel Stage:", "mvow_helicalparallelstage","Front Plate:","mvow_frontplate");
		createDualRow("Auxilary Stage","mvow_auxilarystage", "HS Stage:","mvow_hsstage");
		
		createSubTitle("Torque Arm System","");
		createDualRow("Loose Bolts:","mvow_loosebolts", "Broken Bolts:","mvow_brokenbolts");
		createDualRow("Defect Damper Elements:","mvow_defectdamperclearance", "Too Much Clearance:","mvow_toomuchclearance");
		createDualRow("Cracked/Broken Torque Arm:","mvow_crackedbrokentorquearm", "Needs to be Aligned:","mvow_needstobealigned");
		
		createSubTitle("Defect Accessories","");
		createDualRow("Pt 100 Bearing 1:","mvow_pt100bearing1", "Pt 100 Bearing 2:","mvow_pt100bearing2");
		createDualRow("Pt 100 Bearing 3:","mvow_pt100bearing3", "Oil Pressure (s412):","mvow_oilpressures412");
		createDualRow("Oil Level Sensor:","mvow_oillevelsensor", "Pt 100 Oil Sump:","mvow_pt100oilsump");
		createDualRow("Filter Indicator:","mvow_filterindicator", "Immersion Heater:","mvow_immersionheater");
		createDualRow("Drain Valve:","mvow_drainvalve", "Air Breather:","mvow_airbreather");
		createDualRow("Sight Glass:","mvow_sightglass", "Chip Detector:","mvow_chipdetector");
		
		createTitle("Symptoms");
		createDualRow("Vibrations:","mvow_vibrations", "Noice:","mvow_noise");
		createDualRow("Overall Gearbox Condition:","mvow_overallgearboxcondition", "Debris Found in Gearbox:","mvow_debrisfoundingearbox");
		createDualRow("Debris on Magnet Amount:","mvow_debrisonmagnet", "Debris on Magnet Stage:","mvow_debriesonmagnetstage");
	}

	private static void createGeneralInspection(SubReportType currentType) {
		createTitle("General Component Data");
		createDualRow("Component Group:","mvow_componentgroups", "Component Type:","mvow_componenttype");
		createDualRow("Position of Failed Item:","mvow_positionoffaileditem", "Component Manufacture:","mvow_componentmanufacture");
		createSingleRow("Component Serial Number:","mvow_componentserialnumber");
	}

	private static void createGeneratorInspection(SubReportType currentType) {
		createTitle("Generator Data");
		createDualRow("Serial Number:","mvow_serialnumber","Aux. Equipment:","mvow_auxequipment");
		createSingleRow("Max. Generator Temp. (C):","mvow_maxgeneratortemp");
		createSingleRow("Max. Gen. Temp. Reset Date:","mvow_maxgentempresetdate");
		createSingleRow("Action to be Taken on the Generator:","mvow_actiontobetakenonthegenerator");
		
		createTitle("Mechanical Condition og the Generator");
		createDualRow("Drive End:","mvow_driveend", "Non-Drive End:","mvow_nondriveend");
		createDualRow("Rotor:", "mvow_rotor","Cover:","mvow_cover");
		
		createTitle("Condition of the Air to Air Cooler");
		createDualRow("Internal:","mvow_internal", "External:","mvow_external");
		createMultiLine("Comments:","mvow_comments");
		
		createTitle("Insulation/Induction Test Data");
		createSingleRow("Insulation/Induction Test Data Relevant:","mvow_insulationinductiontestdatarelevant");
		createMultiLine("Comments:","mvow_comment");
		
		createTitle("Insulation Test Data - Minimum 1000v Test Voltage");
		createDualRow("U - Ground:","mvow_uground", "V - Ground:","mvow_vground");
		createDualRow("W - Ground:","mvow_wground", "U - V:","mvow_uv");
		createDualRow("U - W:","mvow_uw", "V - W:","mvow_vw");
		createDualRow("K - Ground:","mvow_kground", "L - Ground:","mvow_lground");
		createDualRow("M - Ground:","mvow_mground", "","");
		
		createTitle("Inductance Test Data (Motor Test)");
		createDualRow("U1 - U2(%):", "mvow_u1u2","V1 - V2(%):","mvow_v1v2");
		createDualRow("W1 - W2(%):","mvow_w1w2", "","");
		
		createDualRow("K1 - L1(%):","mvow_k1l1", "L1 - M1(%):","mvow_l1m1");
		createDualRow("K1 - M1(%):","mvow_k1m1", "K2 - L2(%):","mvow_k2l2");
		createDualRow("L2 - M2(%):","mvow_l2m2", "K2 - M2(%):","mvow_k2m2");
		
		
		createTitle("Damage Categorization");
		createSubTitle("Stator", "");
		createDualRow("Insulation Test Failure:","mvow_insulationtestfailure", "Inductive Test Failure:","mvow_inductivetestfailure");
		createDualRow("Vibrations:","mvow_vibrations", "","");
		createSubTitle("Rotor", "");
		createDualRow("Insulation Test Failure:", "mvow_insulationtestfailurerotor","Induction Test Failure:","mvow_inductiontestfailurerotor");
		createDualRow("Vibrations:","mvow_vibrationsrotor", "Slip Ring Rotor Stud:","mvow_slipringrotorstudrotor");
		createSubTitle("Rotor Leads", "");
		createDualRow("Insulation Damage:","mvow_insulationdamagerotorleads", "Rotor Connection Damage:","mvow_rotorconnectiondamagerotorleads");
		createSubTitle("Stator Leads", "");
		createDualRow("Damaged:","mvow_damaged","", "");
		createSubTitle("Bearings", "");
		createDualRow("Bearings Failure:","mvow_bearingsdamage", "Inner Race Spinning:","mvow_innerracespinningbearings");
		createDualRow("Outer Race Spinning:","mvow_outerracespinningbearings", "Noise:","mvow_noisebearings");
		createDualRow("Vibrations:","mvow_vibrationsbearings", "Seal Failures","mvow_sealfailuresbearings");
		createSubTitle("Misc", "");
		createDualRow("Bearings Housing Damage:","mvow_bearingshousingdamagemisc", "Generator Housing Damage:","mvow_generatorhousingdamagemisc");
		createDualRow("Water Cooling Jacket Damage:","mvow_watercoolingjacketdamagemisc", "PT Sensor Damage:","mvow_ptsensordamagemisc");
		createDualRow("Grounding Slip Ring Damage:","mvow_groundingslipringdamagemisc","", "");
	}

	private static void createMainBearingContent(SubReportType currentType) {
		createTitle("Main Bearing Data");
		createDualRow("Front/Rear:","mvow_frontrear","Lubrication Type:","mvow_lubricationtype");
		createDualRow("Hours on Bearing:","mvow_hoursonbearing","","");
		createSingleRow("Main Bearing Manufacturer:","mvow_mainbearingmanufacturer");
		createSingleRow("Main Bearing Serial Number:","mvow_mainbearingserialnumber");
		createSingleRow( "Main Bearing Temperature:","mvow_mainbearingtemperature");
		createSingleRow("Date For Last Lubrication Change:","mvow_dateforlastlubricationchange");
		createSingleRow("Run Hours on Lubrication:","mvow_runhoursonlubrication");
		createSingleRow("Oil Temperature at Inspeection Applicable:","mvow_oiltemperatureatinspectionapplicable");
	}

	private static void createSkiipackContent(SubReportType currentType) {
		createTitle("Skiipack Data");
		createSingleRow("Number of Components:", "mvow_numberofcomponents");
		createSingleRow("Other Damaged Components Replaced:", "mvow_otherdamagedcomponentsreplaced");
		createTitle("Failure Description");
		createSingleRow("Cause:", "mvow_cause");
		createSingleRow("Quantity of Failed Modules:", "mvow_quantityoffailedmodules");
		
		createSubTitle("2MW","");
		createDualRow("V521:","mvow_v521", "V522:","mvow_v522");
		createDualRow("V523:","mvow_v523", "V524:","mvow_v524");
		createDualRow("V525:","mvow_v525","", "");
		
		createSubTitle("3MW","");
		createDualRow("V524y:","mvow_v524y", "V524x:","mvow_v524x");
		createDualRow("V525y:","mvow_v525y", "V525x:","mvow_v525x");
		createDualRow("V526y:","mvow_v526y", "V526x:","mvow_v526y");
		
	}
	
	private static void createTransformerContent(SubReportType currentType) {
		createTitle("Transformer Data");
		createDualRow("Aux. Equipment:","mvow_auxequipment", "Max. Transformer Temp:","mvow_maxtransformertemp");
		createSingleRow("Max. Transformer. Temp. Reset Date:","mvow_maxtransformertempresetdate");
	
		createTitle("Transformer Data");
		createSingleRow("Action to be Taken on the Transformer:","mvow_actiontobetakenonthetransformer");
		createDualRow("Brackets:","mvow_brackets","HV Coil:","mvow_hvcoil");
		createDualRow("Arc Detection:","mvow_arcdetection","LV Coil:","mvow_hvcoil");
		createDualRow("Climate Condition:","mvow_climatecondition","HV Cable:","mvow_hvcable");
		createDualRow("Surge Arrestor:","mvow_surgearrestor","LV Cable:","mvow_lvcable");
		createDualRow("Connections Bars:","mvow_connectionbars","","");
	}

	private static void createGeneralContent(SubReportType type) {
		createTitle("Wind Turbine Data");
		createDualRow("WTG ID:","mvow_name", "Site:", "mvow_site");
		createDualRow("Inspection Date:","mvow_inspectiondate", "Service Report Number:","mvow_servicereportnumber");
		createDualRow("Service Engineer:","mvow_serviceengineer", "Total Production (kWh):","mvow_totalproductionkwh");
		createDualRow("Run (hrs):","mvow_runhrs", "Generator (hrs):","mvow_generatorhrs");
		if(type == SubReportType.Failure)
			createDualRow("Improvement Case:","mvow_caseimprovement", "Failure Date:","mvow_failuredate");
		else
			createDualRow("Improvement Case:","mvow_caseimprovement","", "");
		
		
		createSingleRow("Installation Date of Failed Component:","mvow_installationdateoffailedcomponent");
		createSingleRow("Run Status After Inspection:", "mvow_runstatusafterinspection");
		createMultiLine("Reason For Service:","mvow_reasonforservice");
		
		//createEmptyLine();
		//createDualRow("Wint Turbine:", "Pad Number:");
		//createDualRow("WTG ID:", "Turbine Type:");
		//createDualRow("MK Version:", "Commisioning Date:");
		//createDualRow("Site:", "");
		
		createTitle("Description");
		createDualRow("Vestas Item Number:","mvow_vestasitemnumber", "Alarm Log Number:","mvow_alarmlognumber");
		createMultiLine("Description:","mvow_description");
		createMultiLine("Consequential Problems/Damages:","mvow_consequentialproblemsdamage");
	}
	
	private static void createVersionInformation(SubReportType type){
		createTitle("Version Information");
		createDualRow("Modified By:","createdby", "Approved:","mvow_approved");
		
		if(type == SubReportType.Inspection || type == SubReportType.Repair)
			createSingleRow("Notification Sent:","mvow_notificationsent");
		
		
	}
	

	private static void closeBody() {
		xmlData += "\n\t\t</ReportItems>\n\t\t<Height>"+bodyHeight+"</Height>\n\t\t<Style />\n\t</Body>\n";
	}

	private static void intiBody() {
		xmlData += "\t<Body>\n\t\t<ReportItems>\n";
	}

	private static void close() {
		xmlData += "\n\t<AutoRefresh>0</AutoRefresh>\n\t<DataSources>\n\t\t<DataSource Name=\"sandbox\">\n\t\t\t<ConnectionProperties>\n\t\t\t\t<DataProvider>MSCRMFETCH</DataProvider>\n\t\t\t\t<ConnectString>https://mvow-sandbox.crm4.dynamics.com;mhivofs0</ConnectString>\n\t\t\t\t<Prompt>Specify a user name and password for data source sandbox:</Prompt>\n\t\t\t</ConnectionProperties>\n\t\t\t<rd:SecurityType>DataBase</rd:SecurityType>\n\t\t\t<rd:DataSourceID>499fa806-eec1-4f66-a795-c93d032f7648</rd:DataSourceID>\n\t\t</DataSource>\n\t</DataSources>";
		
		//DataSets could be added here
		
		
		
		
		xmlData += "\n\t<EmbeddedImages>\n\t\t<EmbeddedImage Name=\"logoimage\">\n\t\t\t<MIMEType>image/gif</MIMEType>\n\t\t\t<ImageData>R0lGODlhIAGGAHAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvY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zz8HPXTRRye9dNNPRz111VdnvXXXX4c9dtlnpz69dttvxz133XfnvXfffwc+eOGHJ754449HPnnll2e+eeefhz566aenvnrrr8c+e+235757778HP3zxx3ctIAA7</ImageData>\n\t\t</EmbeddedImage>\n\t</EmbeddedImages>\n\t<Language>en-US</Language>\n\t<ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>\n\t<rd:ReportUnitType>Cm</rd:ReportUnitType>\n\t<rd:ReportID>a71ed0c6-559a-4cec-a7fd-63ea75e0654e</rd:ReportID>\n</Report>";
	}

	private static void init(){
		formatter = NumberFormat.getInstance(Locale.US);
		formatter.setMinimumFractionDigits(2);
	
		
		xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Report xmlns=\"http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition\" xmlns:rd=\"http://schemas.microsoft.com/SQLServer/reporting/reportdesigner\">\n";
	}
	
	private static void createHeaderAndFooter(){
		xmlData += "\n\t<Width>"
				+formatter.format(usablePageSpace)+"cm</Width>\n\t<Page>\n\t\t<PageHeader>\n\t\t\t<Height>"
				+headerHeight+"</Height>\n\t\t\t<PrintOnFirstPage>true</PrintOnFirstPage>\n\t\t\t<PrintOnLastPage>true</PrintOnLastPage>\n\t\t\t<ReportItems>\n\t\t\t\t<Image Name=\"mvow_logo\">\n\t\t\t\t\t<Source>Embedded</Source>\n\t\t\t\t\t<Value>"
				+logoName+"</Value>\n\t\t\t\t\t<Sizing>FitProportional</Sizing>\n\t\t\t\t\t<Top>"
				+logoFromTop+"</Top>\n\t\t\t\t\t<Left>"
				+logoFromLeft+"</Left>\n\t\t\t\t\t<Height>"
				+logoHeight+"</Height>\n\t\t\t\t\t<Width>"
				+logoWidth+"</Width>\n\t\t\t\t\t<Style>\n\t\t\t\t\t\t<Border>\n\t\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t\t</Border>\n\t\t\t\t\t</Style>\n\t\t\t\t</Image>\n\t\t\t\t<Textbox Name=\"headerText\">\n\t\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t\t<Paragraphs>\n\t\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t\t<Value>"
				+headerText+"</Value>\n\t\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t\t<FontFamily>"
				+headerFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t\t<FontSize>"
				+headerFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t\t\t<FontWeight>"
				+headerFontBold+"</FontWeight>\n\t\t\t\t\t\t\t\t\t\t<Color>"
				+headerFontColor+"</Color>\n\t\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t\t<Style />\n\t\t\t\t\t\t</Paragraph>\n\t\t\t\t\t</Paragraphs>\n\t\t\t\t\t<rd:DefaultName>"
				+headerTextBoxName+"</rd:DefaultName>\n\t\t\t\t\t<Top>"
				+headerTextFromTop+"</Top>\n\t\t\t\t\t<Left>"
				+headerTextFromLeft+"</Left>\n\t\t\t\t\t<Height>"
				+headerTextHeight+"</Height>\n\t\t\t\t\t<Width>"
				+headerTextWidth+"</Width>\n\t\t\t\t\t<ZIndex>"
				+headerZIndex+"</ZIndex>\n\t\t\t\t\t<Style>\n\t\t\t\t\t\t<PaddingLeft>"
				+headerPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t\t<PaddingRight>"
				+headerPaddingRight+"</PaddingRight>\n\t\t\t\t\t\t<PaddingTop>"
				+headerPaddingTop+"</PaddingTop>\n\t\t\t\t\t\t<PaddingBottom>"
				+headerPaddingBottom+"</PaddingBottom>\n\t\t\t\t\t</Style>\n\t\t\t\t</Textbox>\n\t\t\t</ReportItems>\n\t\t\t<Style>\n\t\t\t\t<Border>\n\t\t\t\t\t<Style>None</Style>\n\t\t\t\t</Border>\n\t\t\t</Style>\n\t\t</PageHeader>\n";
		
		
		
		xmlData += "\t\t<PageFooter>\n\t\t\t<Height>"
				+footerHeight+"</Height>\n\t\t\t<PrintOnFirstPage>true</PrintOnFirstPage>\n\t\t\t<PrintOnLastPage>true</PrintOnLastPage>\n\t\t\t<ReportItems>\n\t\t\t\t<Textbox Name=\"PageNumber\">\n\t\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t\t<Paragraphs>\n\t\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t\t<Value>=\"Page \" &amp; Globals.PageNumber &amp; \" of \" &amp; Globals.TotalPages</Value>\n\t\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t\t<FontStyle>Normal</FontStyle>\n\t\t\t\t\t\t\t\t\t\t<FontFamily>"
				+footerPageFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t\t<FontSize>"
				+footerPageFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t\t\t<FontWeight>Normal</FontWeight>\n\t\t\t\t\t\t\t\t\t\t<TextDecoration>None</TextDecoration>\n\t\t\t\t\t\t\t\t\t\t<Color>"
				+footerPageFontColor+"</Color>\n\t\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t\t<Style />\n\t\t\t\t\t\t</Paragraph>\n\t\t\t\t\t</Paragraphs>\n\t\t\t\t\t<rd:DefaultName>PageNumber</rd:DefaultName>\n\t\t\t\t\t<Top>"
				+footerPageTextFromTop+"</Top>\n\t\t\t\t\t<Left>"
				+footerPageTextFromLeft+"</Left>\n\t\t\t\t\t<Height>"
				+footerPageTextHeight+"</Height>\n\t\t\t\t\t<Width>"
				+footerPageTextWidth+"</Width>\n\t\t\t\t\t<Style>\n\t\t\t\t\t\t<Border>\n\t\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t\t</Border>\n\t\t\t\t\t\t<PaddingLeft>"
				+footerPagePaddingLeft+"</PaddingLeft>\n\t\t\t\t\t\t<PaddingRight>"
				+footerPagePaddingRight+"</PaddingRight>\n\t\t\t\t\t\t<PaddingTop>"
				+footerPagePaddingTop+"</PaddingTop>\n\t\t\t\t\t\t<PaddingBottom>"
				+footerPagePaddingBottom+"</PaddingBottom>\n\t\t\t\t\t</Style>\n\t\t\t\t</Textbox>"
				+"<Textbox Name=\"PagePrintData1\">\n\t\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t\t<Paragraphs>\n\t\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t\t<Value>=\"Printed on \" &amp; Globals!ExecutionTime</Value>\n\t\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t\t<FontStyle>Normal</FontStyle>\n\t\t\t\t\t\t\t\t\t\t<FontFamily>"
				+footerPageFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t\t<FontSize>"
				+footerPageFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t\t\t<FontWeight>"
				+"Normal</FontWeight>\n\t\t\t\t\t\t\t\t\t\t<TextDecoration>"
				+"None</TextDecoration>\n\t\t\t\t\t\t\t\t\t\t<Color>"
				+footerPageFontColor+"</Color>\n\t\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t<TextAlign>Right</TextAlign>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</Paragraph>\n\t\t\t\t\t</Paragraphs>\n\t\t\t\t\t<rd:DefaultName>PagePrintData</rd:DefaultName>\n\t\t\t\t\t"
				+footerPageTextFromTop+"</Top>\n\t\t\t\t\t<Left>"
				+footerPageTextFromLeft+"</Left>\n\t\t\t\t\t<Height>"
				+footerPageTextHeight+"</Height>\n\t\t\t\t\t<Width>"
				+footerPageTextWidth+"</Width>\n\t\t\t\t\t<ZIndex>"
				+"5</ZIndex>\n\t\t\t\t\t<Style>\n\t\t\t\t\t\t<Border>\n\t\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t\t</Border>\n\t\t\t\t\t\t<PaddingLeft>"
				+footerPagePaddingLeft+"</PaddingLeft>\n\t\t\t\t\t\t<PaddingRight>"
				+footerPagePaddingRight+"</PaddingRight>\n\t\t\t\t\t\t<PaddingTop>"
				+footerPagePaddingTop+"</PaddingTop>\n\t\t\t\t\t\t<PaddingBottom>"
				+footerPagePaddingBottom+"</PaddingBottom>\n\t\t\t\t\t</Style>\n\t\t\t\t</Textbox>"
				
		        +"\n\t\t\t\t\n\t\t\t</ReportItems>\n\t\t\t<Style>\n\t\t\t\t<Border>\n\t\t\t\t\t<Style>None</Style>\n\t\t\t\t</Border>\n\t\t\t</Style>\n\t\t</PageFooter>\n\t\t<PageHeight>"
				+pageHeight+"</PageHeight>\n\t\t<PageWidth>"
				+pageWidth+"</PageWidth>\n\t\t<LeftMargin>"
				+sideMargins+"</LeftMargin>\n\t\t<RightMargin>"
				+sideMargins+"</RightMargin>\n\t\t<TopMargin>"
				+topbottomMargins+"</TopMargin>\n\t\t<BottomMargin>"
				+topbottomMargins+"</BottomMargin>\n\t\t<ColumnSpacing>"
				+columnSpacing+"</ColumnSpacing>\n\t\t<Style />\n\t</Page>\n";
		
		
		
		
		
		
	}
	
	private static void createEmptyLine(){
		spaceFromTop += titleSpaceHeight;
	}
	
	private static void createTitle(String titleName){
		xmlData += "\t\t\t<Textbox Name=\""
				+titleNamePrefix+titleName.replaceAll("[^A-Za-z0-9]", "")+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+titleName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+titleFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+titleFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t\t<FontWeight>"
				+titleFontWeight+"</FontWeight>\n\t\t\t\t\t\t\t\t\t<Color>"
				+titleFontColor+"</Color>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style />\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+"dn"+titleNamePrefix+titleName.replaceAll("[^A-Za-z0-9]", "")+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+titleLeft+"</Left>\n\t\t\t\t<Height>"
				+titleHeight+"</Height>\n\t\t\t\t<Width>"
				+titleWidth+"</Width>\n\t\t\t\t<ZIndex>"
				+titleZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<PaddingLeft>"
				+titlePaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+titlePaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+titlePaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+titlePaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>\n";
		
		spaceFromTop += titleSpaceHeight;
	}

	private static void createDualRow(String p1BoxName,String mvowVal1, String p2BoxName, String mvowVal2){
		
		String p1Name = p1BoxName.replaceAll("[^A-Za-z0-9]", "");
		String p2Name = p2BoxName.replaceAll("[^A-Za-z0-9]", "");
		double forthOfPage = (usablePageSpace-fieldSpaceWidth)/4;
		double b1 = forthOfPage * 1;
		double b2 = forthOfPage * 1;
		
		
		mvowVal1 = "=First(Fields!" + mvowVal1 + ".Value, \""+dataSetName+"\")";
		mvowVal2 = "=First(Fields!" + mvowVal2 + ".Value, \""+dataSetName+"\")";
		
		if(p1BoxName != ""){
			xmlData += "\t\t\t<Textbox Name=\"p1"
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+p1BoxName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontWeight>Bold</FontWeight>\n\t\t\t\t\t\t\t\t\t<FontSize>"+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style />\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>p1"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format(b1)+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t\t<Width>1pt</Width>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>\n\t\t\t<Textbox Name=\"p2"
				+fieldNamePrefix+p1Name+getId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+mvowVal1+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontSize>"+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t<TextAlign>Right</TextAlign>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>p2"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft+b1)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+b2+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>";
		}
			
		if(p2BoxName != ""){
				xmlData += "\n\t\t\t<Textbox Name=\"p3"
				+fieldNamePrefix+p2Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+p2BoxName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontWeight>Bold</FontWeight>\n\t\t\t\t\t\t\t\t\t<FontSize>"+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style />\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>p3"
				+fieldNamePrefix+p2Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft+b1+b2+fieldSpaceWidth)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+b1+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>\n\t\t\t<Textbox Name=\"p4"
				+fieldNamePrefix+p2Name+getId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+mvowVal2+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontSize>"+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t<TextAlign>Right</TextAlign>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>p4"
				+fieldNamePrefix+p2Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft+b1+b2+fieldSpaceWidth+b1)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+b2+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>\n";
		}
		//add value to spaceFromTop
		spaceFromTop += spaceFromTopHeightOfFieldRow;
	}
	
	private static void createSingleRow(String p1BoxName, String mvowVal){
		String p1Name = p1BoxName.replaceAll("[^A-Za-z0-9]", "");
		if(mvowVal != "")
			mvowVal = "=First(Fields!" + mvowVal + ".Value, \""+dataSetName+"\")";
		
		xmlData += "\t\t\t<Textbox Name=\""
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+p1BoxName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontWeight>Bold</FontWeight>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style />\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format((usablePageSpace)/2)+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>\n\t\t\t<Textbox Name=\""
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+mvowVal+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t<TextAlign>Right</TextAlign>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft+(usablePageSpace)/2)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format((usablePageSpace)/2)+"cm</Width>\n\t\t\t\t<ZIndex>"+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>";
		
		spaceFromTop += spaceFromTopHeightOfFieldRow;
	}
	private static void createSubTitle(String p1BoxName, String p2BoxName) {
		String p1Name = p1BoxName.replaceAll("[^A-Za-z0-9]", "");
		
		xmlData += "\t\t\t<Textbox Name=\""
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+p1BoxName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontWeight>Bold</FontWeight>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+fieldSubFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style />\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldSubHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format((usablePageSpace-fieldSpaceWidth)/2)+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>\n\t\t\t<Textbox Name=\""
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+p2BoxName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontWeight>Bold</FontWeight>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+fieldSubFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t<TextAlign>Right</TextAlign>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft+(usablePageSpace-fieldSpaceWidth)/2+fieldSpaceWidth)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldSubHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format((usablePageSpace-fieldSpaceWidth)/2)+"cm</Width>\n\t\t\t\t<ZIndex>"+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>";
		
		spaceFromTop += spaceFromTopHeightOfFieldRow;
	}

	private static void createMultiLine(String p1BoxName, String mvowVal){
		String p1Name = p1BoxName.replaceAll("[^A-Za-z0-9]", "");

		mvowVal = "=First(Fields!" + mvowVal + ".Value, \""+dataSetName+"\")";
		
		xmlData += "\t\t\t<Textbox Name=\""
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>false</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+p1BoxName+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style />\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format((usablePageSpace-fieldSpaceWidth)/2)+"cm</Width>\n\t\t\t\t<ZIndex>"
				+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>";
				
		spaceFromTop += spaceFromTopHeightOfFieldRow*0.8;		
		xmlData += "\n\t\t\t<Textbox Name=\""
				+fieldNamePrefix+p1Name+nxtId()+"\">\n\t\t\t\t<CanGrow>true</CanGrow>\n\t\t\t\t<KeepTogether>true</KeepTogether>\n\t\t\t\t<Paragraphs>\n\t\t\t\t\t<Paragraph>\n\t\t\t\t\t\t<TextRuns>\n\t\t\t\t\t\t\t<TextRun>\n\t\t\t\t\t\t\t\t<Value>"
				+mvowVal+"</Value>\n\t\t\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t\t\t<FontFamily>"
				+fieldFont+"</FontFamily>\n\t\t\t\t\t\t\t\t\t<FontSize>"
				+fieldFontSize+"</FontSize>\n\t\t\t\t\t\t\t\t</Style>\n\t\t\t\t\t\t\t</TextRun>\n\t\t\t\t\t\t</TextRuns>\n\t\t\t\t\t\t<Style>\n\t\t\t\t\t\t\t<TextAlign>Left</TextAlign>\n\t\t\t\t\t\t</Style>\n\t\t\t\t\t</Paragraph>\n\t\t\t\t</Paragraphs>\n\t\t\t\t<rd:DefaultName>"
				+fieldNamePrefix+p1Name+getId()+"</rd:DefaultName>\n\t\t\t\t<Top>"
				+formatter.format(spaceFromTop)+"cm</Top>\n\t\t\t\t<Left>"
				+formatter.format(fieldLeft)+"cm</Left>\n\t\t\t\t<Height>"
				+formatter.format(fieldHeight)+"cm</Height>\n\t\t\t\t<Width>"
				+formatter.format((usablePageSpace))+"cm</Width>\n\t\t\t\t<ZIndex>"+fieldZIndex+"</ZIndex>\n\t\t\t\t<Style>\n\t\t\t\t\t<Border>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</Border>\n\t\t\t\t\t<BottomBorder>\n\t\t\t\t\t\t<Color>"
				+fieldFontColor+"</Color>\n\t\t\t\t\t\t<Style>None</Style>\n\t\t\t\t\t</BottomBorder>\n\t\t\t\t\t<PaddingLeft>"
				+fieldPaddingLeft+"</PaddingLeft>\n\t\t\t\t\t<PaddingRight>"
				+fieldPaddingRight+"</PaddingRight>\n\t\t\t\t\t<PaddingTop>"
				+fieldPaddingTop+"</PaddingTop>\n\t\t\t\t\t<PaddingBottom>"
				+fieldPaddingBottom+"</PaddingBottom>\n\t\t\t\t</Style>\n\t\t\t</Textbox>";
		
		spaceFromTop += spaceFromTopHeightOfFieldRow;
	}
	
	private static void save(){
		//System.out.println(xmlData);
		System.out.println("File saved!");
	
	}
	
	
	private static int getId(){
		return _id;
	}
	private static int nxtId(){
		_id++;
		return _id;
	}
}
